package com.datang.petstore.controller;

import com.datang.petstore.aop.ForbidAnnotation;
import com.datang.petstore.entity.MicroblogShareRecord;
import com.datang.petstore.model.MicroblogShareRecordRequest;
import com.datang.petstore.resultpage.Result;
import com.datang.petstore.service.MicroblogShareRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-11-04 10:40
 * @notify 分享api
 * @version 1.0
 */
@RestController
public class MicroblogShareRecordController {

    @Autowired
    private MicroblogShareRecordService microblogShareRecordService;

    /*
     * @author 顶风少年
     * @date 2019/11/4 10:51
     * @mail dfsn199703132038@foxmail.com
     * @throws
     * @param
     * @param microblogShareRecord
     * @result void
     * @notify 添加微博分享日志
     * version 1.0
     */
    @PostMapping(value = "microblog/share")
    @ForbidAnnotation
    public Result addMicroblogShareRecord(@RequestBody MicroblogShareRecordRequest microblogShareRecordRequest) {
        MicroblogShareRecord microblogShareRecord = new MicroblogShareRecord();
        BeanUtils.copyProperties(microblogShareRecordRequest, microblogShareRecord);
        microblogShareRecordService.addMicroblogShareRecord(microblogShareRecord);
        return Result.ok();
    }
}
